package ace.cmp.data.methodname.method.name.sql.entity.model;

import ace.cmp.data.methodname.method.name.sql.core.enums.SqlCommandTypeEnum;
import java.util.List;
import java.util.Optional;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author caspar
 * @date 2023/2/17 14:16
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EntityMethodNameToQueryResult {
  /**
   * sql command 类型
   *
   * @return
   */
  private SqlCommandTypeEnum sqlCommandType;

  /**
   * 获取多少条数据
   */
  private Optional<Integer> top;

  /**
   * 包含 distinct 关键字
   */
  private Boolean hasDistinctKeyword;

  /**
   * 从方法名上解析实体属性过滤条件元数据
   * 例子：findIdAndNameAndCodeByIdAndName,
   * 结果：Id equal,Name equal
   *
   * @return
   */
  private List<EntityMethodNameToQueryFilter> filters;

  /**
   * 从方法名上解析实体属性排序信息
   * 例子：findIdAndNameAndCodeByIdAndNameOrderByIdDescNameAsc
   * 结果：Id desc,Name Asc
   */
  private List<EntityMethodNameToQuerySort> sorts;
}
